<?php

/**
 * ChanterTemplate form base class.
 *
 * @method ChanterTemplate getObject() Returns the current form's model object
 *
 * @package    aiontoolskit
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseChanterTemplateForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'lvl'                 => new sfWidgetFormInputText(),
      'maxHp'               => new sfWidgetFormInputText(),
      'maxMp'               => new sfWidgetFormInputText(),
      'power'               => new sfWidgetFormInputText(),
      'health'              => new sfWidgetFormInputText(),
      'agility'             => new sfWidgetFormInputText(),
      'accuracy'            => new sfWidgetFormInputText(),
      'knowledge'           => new sfWidgetFormInputText(),
      'will'                => new sfWidgetFormInputText(),
      'walk_speed'          => new sfWidgetFormInputText(),
      'run_speed'           => new sfWidgetFormInputText(),
      'fly_speed'           => new sfWidgetFormInputText(),
      'attack_speed'        => new sfWidgetFormInputText(),
      'evasion'             => new sfWidgetFormInputText(),
      'block'               => new sfWidgetFormInputText(),
      'parry'               => new sfWidgetFormInputText(),
      'main_hand_attack'    => new sfWidgetFormInputText(),
      'main_hand_accuracy'  => new sfWidgetFormInputText(),
      'main_hand_crit_rate' => new sfWidgetFormInputText(),
      'magic_accuracy'      => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'lvl'                 => new sfValidatorInteger(),
      'maxHp'               => new sfValidatorInteger(),
      'maxMp'               => new sfValidatorInteger(),
      'power'               => new sfValidatorInteger(),
      'health'              => new sfValidatorInteger(),
      'agility'             => new sfValidatorInteger(),
      'accuracy'            => new sfValidatorInteger(),
      'knowledge'           => new sfValidatorInteger(),
      'will'                => new sfValidatorInteger(),
      'walk_speed'          => new sfValidatorInteger(),
      'run_speed'           => new sfValidatorInteger(),
      'fly_speed'           => new sfValidatorInteger(),
      'attack_speed'        => new sfValidatorInteger(),
      'evasion'             => new sfValidatorInteger(),
      'block'               => new sfValidatorInteger(),
      'parry'               => new sfValidatorInteger(),
      'main_hand_attack'    => new sfValidatorInteger(),
      'main_hand_accuracy'  => new sfValidatorInteger(),
      'main_hand_crit_rate' => new sfValidatorInteger(),
      'magic_accuracy'      => new sfValidatorInteger(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'ChanterTemplate', 'column' => array('lvl')))
    );

    $this->widgetSchema->setNameFormat('chanter_template[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ChanterTemplate';
  }

}
